<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    if (session.getAttribute("user") == null) {
        response.sendRedirect(request.getContextPath() + "/login.jsp");
        return;
    }
%>
<html>
<head>
    <title>员工信息管理系统 - 首页</title>
    <link rel="stylesheet" href="../css/style.css">
</head>
<body>
<header>
    <div class="logo">员工信息管理系统</div>
    <nav>
        <ul>
            <li><a href="dashboard" class="active">首页</a></li>
            <li><a href="dashboard/employees?action=list">员工管理</a></li>
        </ul>
    </nav>
    <div class="user-info">
        <span>欢迎, <%= ((com.company.ems.model.User)session.getAttribute("user")).getUsername() %></span>
        <a href="logout" class="logout-btn">退出登录</a>
    </div>
</header>

<main>
    <div class="dashboard-container">
        <h2>系统首页</h2>
        <div class="dashboard-stats">
            <div class="stat-card">
                <h3>员工总数</h3>
                <p>3</p> <!-- 实际应用中应从数据库获取 -->
            </div>
            <div class="stat-card">
                <h3>部门数量</h3>
                <p>3</p> <!-- 实际应用中应从数据库获取 -->
            </div>
        </div>

        <div class="action-buttons">
            <a href="dashboard/employees?action=list" class="btn primary">管理员工</a>
            <a href="dashboard/employees?action=add" class="btn success">添加新员工</a>
        </div>
    </div>
</main>

<footer>
    <p>&copy; 2023 员工信息管理系统 版权所有</p>
</footer>
</body>
</html>